<template>
<div>
  <div class="header" style="width:100%;height:150px;background: #1989fa;border-radius: 0 0 1.5rem 1.5rem;">
    <div style="color:#fff;height:2rem;line-height:2rem;font-size: .8rem;position:relative;top:15px;">
      <van-image
        round
        width="5rem"
        height="5rem"
        :src="handImg"
        style="float:left;margin:10px;"
      />
      <p class="van-ellipsis" style="float:left;margin:0;position:relative;top:40px;max-width: 200px;">{{nickname}}</p><br>
    </div>
  </div>
  <div style="min-height:100px;background: #fff;position: relative;top:-1.5rem;margin-left:.5rem;margin-right:.5rem;border-radius:.25rem;">
    <div style="float:left;width:100%;margin-top:.5rem;font-size:.9rem;">
      <P style="float: left; padding-left: 10px; margin: 0;">我的订单</P>
      <p style="margin: 0; text-align:-webkit-right; padding-right:30px; font-size:.7rem;color:#9a9a9a" @click="taozhuang2" >查看全部订单</p>
      <van-icon name="arrow" style="float:right;position:relative;top:-15px;font-size:16px;margin-right:8px;" @click="taozhuang2" />
    </div>
    <div style="width:100%;font-size:.8rem;position:relative;top:.5rem;">
      <div style="width: 25%;float:left;" @click="taozhuang1">
        <van-icon name="records" style="font-size:1.4rem;width:100%;" />
        已完结
      </div>
      <div style="width: 25%;float:left;" @click="taozhuang3">
        <van-icon name="tosend" style="font-size:1.4rem;width:100%;" />
        待发货
      </div>
      <div style="width: 25%;float:left;" @click="taozhuang4">
        <van-icon name="logistics" style="font-size:1.4rem;width:100%;" />
        待收货
      </div>
      <div style="width: 25%;float:left;" @click="taozhuang1">
        <van-icon name="records" style="font-size:1.4rem;width:100%;" />
        已完结
      </div>
    </div>
  </div>
  <div style="background:#fff;border-radius:.25rem;margin-left:.5rem;margin-right:.5rem;min-height:100px;overflow: hidden;position:relative;top:-15px;">
    <div style="float:left;width:100%;font-size:.8rem;height:2.5rem;line-height:2.5rem;">
      <P style="float: left; padding-left: 10px; margin: 0;">我的砍价</P>
      <van-icon name="arrow" style="float:right;font-size:17px;margin-right:7px;height:2.5rem;line-height:2.5rem;" />
    </div>
    <div style="float:left;width:100%;font-size:.8rem;height:2.5rem;line-height:2.5rem;">
      <P style="float: left; padding-left: 10px; margin: 0;">我的奖品</P>
      <van-icon name="arrow" style="float:right;font-size:17px;margin-right:7px;height:2.5rem;line-height:2.5rem;" />
    </div>
    <div style="float:left;width:100%;font-size:.8rem;height:2.5rem;line-height:2.5rem;">
      <P style="float: left; padding-left: 10px; margin: 0;">我的收藏</P>
      <van-icon name="arrow" style="float:right;font-size:17px;margin-right:7px;height:2.5rem;line-height:2.5rem;" />
    </div>
    <div style="float:left;width:100%;font-size:.8rem;height:2.5rem;line-height:2.5rem;" @click="taozhuang6">
      <P style="float: left; padding-left: 10px; margin: 0;">我的小孩</P>
      <van-icon name="arrow" style="float:right;font-size:17px;margin-right:7px;height:2.5rem;line-height:2.5rem;" />
    </div>
    <div style="float:left;width:100%;font-size:.8rem;height:2.5rem;line-height:2.5rem;" @click="taozhuang5">
      <P style="float: left; padding-left: 10px; margin: 0;">收货地址</P>
      <van-icon name="arrow" style="float:right;font-size:17px;margin-right:7px;height:2.5rem;line-height:2.5rem;" />
    </div>
    <div style="float:left;width:100%;font-size:.8rem;height:2.5rem;line-height:2.5rem;">
      <P style="float: left; padding-left: 10px; margin: 0;">联系我们</P>
      <van-icon name="arrow" style="float:right;font-size:17px;margin-right:7px;height:2.5rem;line-height:2.5rem;" />
    </div>
  </div>
</div>
</template>

<script>
import commonjs from '@/common/commonUtils.js'
import headImg from '../../assets/img/hand.png'
export default {
  name: 'user',
  data () {
    return {
      active: [0, 1, 2, 3],
      handImg: headImg,
      nickname: '昵称'
    }
  },
  created () {
    let isWchat = commonjs.is_wexin()
    if (isWchat) {
      let wechat = JSON.parse(commonjs.getStorage('wechat'))
      if (wechat !== null) { // 判断是否微信授权登录
        this.handImg = wechat.wechatImgUrl
        this.nickname = wechat.wechatName
      }
    }
  },
  methods: {
    taozhuang1 (active) {
      this.$router.push({path: '/order', query: {active: this.active[1]}})
    },
    taozhuang2 (active) {
      this.$router.push({path: '/order', query: {active: this.active[0]}})
    },
    taozhuang3 (active) {
      this.$router.push({path: '/order', query: {active: this.active[2]}})
    },
    taozhuang4 (active) {
      this.$router.push({path: '/order', query: {active: this.active[3]}})
    },
    taozhuang5 () {
      this.$router.push('/address')
    },
    taozhuang6 () {
      this.$router.push('/child')
    }
  }
}
</script>

<style scoped>
</style>
